package com.wechat.service.account.starter.messageManage;

import com.wechat.service.account.dto.messageManage.replyUserMessage.*;
import com.wechat.service.account.util.XmlUtil;
import org.springframework.stereotype.Service;

/**
 * @author： ygl
 * @date： 2019/07/13
 * @Description：
 * 被动回复用户消息
 */
@Service
public class ReplyUserMessageService {

    /**
     * 回复文本消息
     * @param msgDTO
     * @return
     */
    public Object replyTextMessage(ReplyTextMessageDTO msgDTO){
        msgDTO.setMsgType("text");
        msgDTO.setCreateTime(System.currentTimeMillis());
        return XmlUtil.beanToXml(msgDTO);
    }
    /**
     * 回复图片消息
     * @param msgDTO
     * @return
     */
    public Object replyImageMessage(ReplyImageMessageDTO msgDTO){
        msgDTO.setMsgType("image");
        msgDTO.setCreateTime(System.currentTimeMillis());
        return XmlUtil.beanToXml(msgDTO);
    }
    /**
     * 回复语音消息
     * @param msgDTO
     * @return
     */
    public Object replyVoiceMessage(ReplyVoiceMessageDTO msgDTO){
        msgDTO.setMsgType("voice");
        msgDTO.setCreateTime(System.currentTimeMillis());
        return XmlUtil.beanToXml(msgDTO);
    }
    /**
     * 回复视频消息
     * @param msgDTO
     * @return
     */
    public Object replyVideoMessage(ReplyVideoMessageDTO msgDTO){
        msgDTO.setMsgType("video");
        msgDTO.setCreateTime(System.currentTimeMillis());
        return XmlUtil.beanToXml(msgDTO);
    }
    /**
     * 回复音乐消息
     * @param msgDTO
     * @return
     */
    public Object replyMusicMessage(ReplyMusicMessageDTO msgDTO){
        msgDTO.setMsgType("music");
        msgDTO.setCreateTime(System.currentTimeMillis());
        return XmlUtil.beanToXml(msgDTO);
    }
    /**
     * 回复图文消息
     * @param msgDTO
     * @return
     */
    public Object replyImageTextMessage(ReplyImageTextMessageDTO msgDTO){
        msgDTO.setMsgType("news");
        msgDTO.setCreateTime(System.currentTimeMillis());
        return XmlUtil.imageTextToXml(msgDTO);
    }
}
